home *** CD-ROM | disk | FTP | other *** search
- /* Name: DownloadInline.www */
- /* AMosaic script to download inlined images and automatically spawn */
- /* the appropriate viewer, for users of ADOS 2.0/2.1 */
- /* ADOS 3.0/3.1 users shouldn't need this, because datatypes handle */
- /* correctly. (I think :-) */
- /*
- /*Installation: */
- /* Copy it to your rexx: directory. */
- /* */
- /* Here's how this script works. It will accept either zero or one */
- /* command line argument. If there are no command line arguments, the */
- /* script will find out how many inlined images there are in the */
- /* current document and display that number in the shell from which */
- /* AMosaic was started. (If you start AMosaic from the WB, I have no */
- /* idea what will happen. Try it and find out, and let me know...I'm */
- /* too lazy to test it.) */
- /* The script will accept one argument, as mentioned above. This */
- /* is the number of the inlined image you wish to access. So, if you */
- /* want the first inlined image in a page, put a 1 as the argument. */
- /* Simple, eh? */
- /* */
- /* So to use this script, select the Macro menu item from the Rexx menu */
- /* and enter the name of this script followed by a number (or don't */
- /* give anything, and it will report how many inlined images there are) */
- /* */
- /* I suggest that you edit the env:Mosaic/prefs file (and corresponding */
- /* file in envarc:) and make this script correspond to a menu hotkey. */
- /* Here's what my prefs file looks like: */
- /* DelayImageLoads true
- ImageCacheSize 0
- RexxMacro1 Get Inline 1 | downloadinline 1
- RexxMacro2 Get Inline 2 | downloadinline 2
- RexxMacro3 Get Inline 3 | downloadinline 3
- RexxMacro4 Get Inline 4 | downloadinline 4
- RexxMacro5 Get Inline 5 | downloadinline 5
- RexxMacro6 Get Inline 6 | downloadinline 6
- RexxMacro7 Get Inline 7 | downloadinline 7
- RexxMacro8 Add to Hotlist | add-hotlist
- RexxMacro9 Jump to Hotlist | "'jump url file://localhost/env:Mosaic/hotlist.html'"
- RexxMacro10 # of Inlines | downloadinline
-
- As you can see, if I press lamiga-0, I will automatically get the number
- of inlined images displayed in the shell. And I have set up
- lamiga-1 -> lamiga-7 to correspond to downloading that respective
- inlined image. (i.e. if I press lamiga-5, I will get the fifth inlined
- image on the page, if it exists).
- If there are lots of inlined images (say, for example 20 on a page),
- and you want to see the 17th one, you'll have to select the Macro
- menu item, and manually put 17 on the command line.
-
- This script does a little bit of error checking. It makes sure there
- are inlined images on the page in the first place. It also checks
- to make sure you haven't asked for an inlined image that doesn't exist.
- (Well, if you enter an argument of -5, AMosaic will try and get a
- non-existant file, and report an error, but the script does rudimenary
- error checking.
-
- Caveats:
- - I start AMosaic from the shell, so the say commands in this script
- will output to the shell that I started from. I have no idea what
- happens when AMosaic is started from the WB and it wants to say
- something. I expect nothing will happen, in which case you can't
- see how many inlined images are on the page (unless you count them
- yourself. :-)
- - This is not the best way to see these inline images. It'd be much
- better if one could simply click on an inlined image and have it
- downloaded. I *know* there's a way to do this, but I haven't
- figured it out yet. The main problem is I don't know alot of the
- terms of the WWW (like what an anchor is). Oh well, for the time
- being, this will suffice.
-
- Comment or questions or suggestions or help or just rude mail can
- be sent to:
- tcourtna@eagle.wbm.ca
-
- Enjoy.
-
- Oh, if this doesn't work on your setup, let me know and I'll see what
- I can do to fix it.
-
- I suppose I should also include a disclaimer. I accept no responsibility
- for the actions of this program. Use at your own risk. (I do :-).
-
- Hmmm, the documentation is more than twice as long as script itself,
- I suppose I should stop. */
-
- /* get which inlined image to download */
- parse arg charnumber
-
- /* if no argument given (i.e. no image #) get # of inlined images on page */
- if charnumber = ''
- then do
- 'fetch images stem='mystem
- say 'Number of inlined images on this page: 'mystem.0
- exit
- end
-
- options results
- 'fetch images stem='mystem
-
- inlinecount = mystem.0
- /* make sure there are inlined images on this page */
- if inlinecount = 0
- then do
- say 'No Inlined images on this page'
- exit
- end
- /* make sure user doesn't specify illegal inline image # */
- else if inlinecount < charnumber
- then do
- say 'That inline image does not exist.'
- say 'Pick a number <= 'inlinecount
- exit
- end
- /* valid number...get URL! */
- else 'jump url 'mystem.charnumber.URL
-